<%@ page isELIgnored="false"%>
<%@ page import="com.google.appengine.api.users.UserServiceFactory"%>
<%@ page import="com.ridanlabs.professorwebsite.models.UserProfile"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/static/css/gae.css" type="text/css" />
<title>Home Page</title>
</head>
<body>
	<div id="content">
		<h3>The Home Page</h3>
		<p>
			Welcome back
			<sec:authentication property="principal.firstName" />
		</p>
		<p>
			You can get to this page if you have authenticated and are a
			registered user. You are registered as:
			<sec:authentication property="principal.firstName" />
			<sec:authentication property="principal.lastName" />
		</p>

		<p>
			<b> Example of accessing model data from controller: </b> 
			<br /> 
			
			EL: ${user.firstName }, ${user.lastName }
			<br />
			
			JSTL: <c:out value="${user.firstName }" /> , <c:out value="${user.lastName }" />
			<br />
			
			<%
				UserProfile user = (UserProfile) request.getAttribute("user");
			%>
			Java: <%=user.getFirstName()%>, <%=user.getLastName()%>
		</p>

		<table>
			<c:forEach var="x" begin="0" end="10" step="2">
				<!-- JSTL Example -->
				<tr>
					<td><c:out value="${x}" /></td>
					<td><c:out value="${x * x}" /></td>
				</tr>
			</c:forEach>
		</table>

		<p>
			<a href="/logout">Logout</a>.
		</p>
	</div>
</body>
</html>
